package com.lm.paymentcanal;

import com.lm.paymentcanal.canal.CanalClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import javax.annotation.Resource;

@Slf4j
@SpringBootApplication
public class PaymentCanalApplication  implements CommandLineRunner{

    @Resource
    private CanalClient canalClient;

    public static void main(String[] args) {
        ConfigurableApplicationContext application = SpringApplication.run(PaymentCanalApplication.class, args);
        Environment env = application.getEnvironment();
        log.info("应用 {} 运行成功！",env.getProperty("spring.application.name"));
    }

    @Override
    public void run(String... args){
        log.info("run canal.........");
        canalClient.run();
    }
}
